| Path: | merb-slices/lib/generators/templates/full/lib/%base_name%.rb |
| Last Update: | Tue Jul 28 08:32:52 +0200 2009 |
Activation hook - runs after AfterAppLoads BootLoader
# File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 38
38: def self.activate
39: end
Deactivation hook - triggered by Merb::Slices.deactivate(<%= module_name %>)
# File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 42
42: def self.deactivate
43: end
Initialization hook - runs before AfterAppLoads BootLoader
# File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 34
34: def self.init
35: end
Setup routes inside the host application
@param scope<Merb::Router::Behaviour>
Routes will be added within this scope (namespace). In fact, any router behaviour is a valid namespace, so you can attach routes at any level of your router setup.
@note prefix your named routes with :<%= symbol_name %>_
to avoid potential conflicts with global named routes.
# File merb-slices/lib/generators/templates/full/lib/%base_name%.rb, line 54
54: def self.setup_router(scope)
55: # example of a named route
56: scope.match('/index(.:format)').to(:controller => 'main', :action => 'index').name(:index)
57: # the slice is mounted at /<%= base_name %> - note that it comes before default_routes
58: scope.match('/').to(:controller => 'main', :action => 'index').name(:home)
59: # enable slice-level default routes by default
60: scope.default_routes
61: end